<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div  th:fragment="js">
    <script src="./layui.js"></script>
    <script src="./lay/modules/layer.js"></script>
    <script src="./js/jquery-1.8.3.min.js"></script>
    <script src="./js/stype.js"></script>
    <script>
        $(function(){
            var user = localStorage.getItem('user');
            user = JSON.parse(user)
            if(isEmpty(user)){
                window.location.href="./login.html"
            }
            $("#username").append('<img src="'+user.ggLogo+'" class="layui-nav-img">'+user.ggNicheng)

        })


        function signOut() {
            //删除localStorage
            localStorage.removeItem('user')
            //请求后台
            $.ajax({
                type: 'POST',
                url: "/signOut",
                success: function (message) {
                    window.location.href="./login.html"
                }
            })
        }

        layui.use('element', function(){
            var element = layui.element;

        });
    </script>
    <script>
        //一般直接写在一个js文件中
        layui.use(['layer', 'form', 'element'], function () {
            var layer = layui.layer
                , form = layui.form
                , $ = layui.jquery;

            $(function () {
                // 左侧栏向左折叠
                $("#menuBar").on('click', function () {
                    if ($("body").hasClass("mini-sidebar")) {
                        $("body").removeClass("mini-sidebar");
                        $(this).addClass("layui-icon-shrink-right");
                        $(this).removeClass("layui-icon-spread-left");
                    } else {
                        $("body").addClass("mini-sidebar");
                        $(this).removeClass("layui-icon-shrink-right");
                        $(this).addClass("layui-icon-spread-left");
                    }
                });
            })

        });
    </script>
</div>
</body>
</html>